<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>媒体查询（media）</title>
    <style>
        #div0{
            width: 100%;
            height: 500px;
        }
        #div0 div{
            float: left;
            height: 200px;
        }
        @media screen and (min-device-width:400px) and (max-device-width:500px) {
            #div0 div{
                width: 33.3%;
             }
             #div0 div:nth-child(1){
                 background-color: red;
             }
             #div0 div:nth-child(2){
                 background-color: red;
             }
             #div0 div:nth-child(3){
                 background-color: red;
             }
        }
        @media screen and (min-device-width:300px) and (max-device-width:399px) {
            #div0 div{
                width: 50%;
             }
             #div0 div:nth-child(1){
                 background-color: red;
             }
             #div0 div:nth-child(2){
                 background-color: red;
             }
             #div0 div:nth-child(3){
                 background-color: red;
             }
        }
        @media screen and (min-device-width:200px) and (max-device-width:299px) {
            #div0 div{
                width: 100%;
             }
             #div0 div:nth-child(1){
                 background-color: red;
             }
             #div0 div:nth-child(2){
                 background-color: red;
             }
             #div0 div:nth-child(3){
                 background-color: red;
             }
        }
    </style>
</head>
<body>
    <div id="div0">
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
</html>